package com.yowasa.xiuxian.engine.travel.adventure;

import com.google.common.collect.Sets;
import com.yowasa.xiuxian.engine.travel.AdventureInterface;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.MapEnum;
import com.yowasa.xiuxian.service.helper.UserHelper;
import com.yowasa.xiuxian.util.RandomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Set;

@Component
public class LingQiChaoXi implements AdventureInterface {

    @Autowired
    private UserHelper userHelper;

    @Override
    public Set<MapEnum> limitMaps() {
        return Sets.newHashSet(MapEnum.JUE_YUN_JIAN,MapEnum.PU_GONG_YING_HAI);
    }


    @Override
    public String exec(UserBO user) {
        userHelper.lockUser(user,60,user.getName()+"正在秘境探索中");
        int i = RandomUtil.randomInt(5) + 3;
        if(user.getLevel() != 101){
            user.setLevel(Math.min(100,user.getLevel() + i));
        }
        return "秘境中出现了灵气潮汐爆发，你连忙盘坐修炼，消耗两个月，修为提升 百分之"+i;
    }


    public boolean isConflict() {
        return true;
    }

    public int weight() {
        return 5;
    }

}